<?php
namespace  Admin\Controller;

use Utuo\BackgroundController;

class AgentAdminController extends BackgroundController {
	
	protected $aid;
	
	public function _initialize() {
		$this->aid = I('aid');
		$this->setControllerTitle('管理员管理');
		$this->setActionTitle(array(
				'index' => '管理员列表',
				'add' => '添加管理员',
				'modify' => '修改管理员',
				'recycle' => '回收站',
	
		),'','aid='.$this->aid);
		$this->setActionNav(array(
				'index',
				'add',
				'recycle'
		));
	}
	
	public function getLists($is_deleted) {
		$condition = array(
				'agent_id' => $this->aid,
				'is_deleted' => $is_deleted, );
		$customerAdminLists = M('AgentAdmin')->where($condition)->select();
		$this->assign('agentAdminLists', $customerAdminLists);
		$this->display();
	}
	
	public function addAction() {
		$this->assign("agentAdmin", array( 'agent_id' => $this->aid ));
		$this->display();
	}
	
	public function modifyAction() {
	     $agentAdmin = $this->getOneById("AgentAdmin");
	     $this->assign("agentAdmin", $agentAdmin);
	     $this->display();
	}
	
	public function saveAction(){
		$this->submitPost('AgentAdmin');
	}
	
	// 删除数据
	public function removePostAction() {
		$this->ajaxRemove();
	}
	
	// 彻底删除
	public function deletePostAction() {
		$this->ajaxDelete();
	}
	
	// 恢复管理员
	public function restorePostAction() {
		$this->ajaxRestore();
	}
	
	public function setStatusPostAction() {
		$this->ajaxSetStatus();
	}
	
	
}